<html>
<head>
</head>
<body>
<input type="submit" value="Make printable" id="make-printable-button" onclick="makePrintable()"/>

<script type="text/javascript">
    function makePrintable() {
        jQuery(".sequence_diagram_clickable").each(function (i, item) {
            var text = jQuery(item).text();
            jQuery(item).text((i + 1) + ". " + text);
        });

        var inlinePayloads = jQuery("#payloads").clone();
        inlinePayloads.attr('id', 'inline-payloads');
        jQuery("#message-details").empty();
        jQuery("#message-details").append(inlinePayloads);
        jQuery("h3", inlinePayloads).each(function (i, item) {
            var text = jQuery(item).text();
            jQuery(item).text((i + 1) + ". " + text);

        });
        jQuery("#inline-payloads").show();
    }
</script>
</body>
</html>